﻿using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Framework.Library.Data.DAL.JObject;
using ServiceStack.Text;

namespace Framework.Library.Base.Base
{
    public class BaseTemplate : UserControl
    {
        /// <summary>
        /// All content containers.
        /// </summary>
        public Dictionary<string, Control> Containers
        {
            get
            {
                var tbl = new Dictionary<string, Control>();
                foreach (Control ctrl in Controls)
                {
                    if (ctrl is PlaceHolder)
                    {
                        tbl.Add(ctrl.ID, ctrl);
                    }
                        // Also check for user controls with content placeholders.
                    else if (ctrl is UserControl)
                    {
                        foreach (Control ctrl2 in ctrl.Controls)
                        {
                            if (ctrl2 is PlaceHolder)
                            {
                                tbl.Add(ctrl2.ID, ctrl2);
                            }
                        }
                    }
                }
                return tbl;
            }
        }

        public static string BaseTheme
        {
            get
            {
                JTheme info = new JTheme();
                info.title = "Default";
                info.description = "NightStalker's Framework written by Nguyễn Quang Dũng";
                var lstMenu = new Dictionary<string, string>();
                lstMenu.Add("keywords", "NightStalker, NS, DungNQ, Nguyễn Quang Dũng, 0936660044, Portal");
                lstMenu.Add("description", "NightStalker's Framework written by Nguyễn Quang Dũng");
                info.meta = lstMenu;
                info.control = "/Default.ascx";
                info.placeholder = new string[] { "hornav", "navbar", "breadcrumbs", "banner", "left", "right", "top", "user1", "user2", "user3", "user4", "user5", "footer", "syndicate", "debug", "content" };
                var lstCss = new List<string>();
                lstCss.Add("/Templates/Client/Resources/css/ns.menu.css");
                lstCss.Add("/Templates/Client/Resources/css/style.css");
                info.css = lstCss;
                var lstJs = new List<string>();
                lstJs.Add("/Templates/Client/Resources/javascript/jquery-1.4.4.min.js");
                lstJs.Add("/Templates/Client/Resources/javascript/ns.menu.js");
                info.js = lstJs;
                return JsonSerializer.SerializeToString(info);
            }
        }
    }
}